/**
 * Created by yangshengjiepro on 15/5/21.
 */

var HeroHelper = function () {
    this.flag = 0;
};

var spriteFrameCache = cc.spriteFrameCache;
var USERJM = ".png";

//初始化开始UI
HeroHelper.CreatHero = function(name,act){

    var frameNamebase = HeroRes + name + "/" + act + "/" + name + "_" + act + "_" + 0 + USERJM;
    var node = new cc.Sprite.create(frameNamebase);
    node.setScale(1);
    var animation = new cc.Animation();
    var node_basesize = node.getContentSize();

    for (var i = 0; i < 4; i++) {
        var frameName = HeroRes + name + "/" + act + "/" + name + "_" + act + "_" + i + USERJM;
        var getname = name + "_" + act + "_" + i;
        animation.addSpriteFrameWithFile(frameName);
        Mlog.c("res ok:", frameName);
    }


    animation.setDelayPerUnit(2.8 / 14);
    animation.setRestoreOriginalFrame(true);
    animation.setLoops(100000);
    var action = cc.animate(animation);



    node.runAction(action);

    node.setAnchorPoint(cc.p(0.5,0.5));
    return node;

};